#include "load.h"
#include <proc/command.h>
#include <proc/exception.h>

Load::Load(TableMapping &tableMapping, Oracle::Connection &connection):tableMapping(tableMapping), connection(connection)
{
}

Load::~Load()
{
}

int Load::load()
{
	if (createSql() == -1){
		error<<"createSql error"<<endl;
		return -1;
	}
	Command command(connection);	
	command.commandText  = sql;
	try{
		command.executeNonQuery();
	}catch(Exception *e){
		error<<command.commandText<<endl;
		error<<e->code()<<endl;
		error<<e->what()<<endl;
		delete e;
		return -1;
	}
	return 0;	
}

